<ng-container body-head>
  <div class="info-body">
    <div class="title">信息</div>
    <div class="category">授权信息</div>
    <div class="detail">
      <ng-container *ngIf="licenseInfo$ | async as licenseInfo" [ngSwitch]="licenseInfo.expiredAt">
        <div *ngSwitchCase="0">
          <div>授权状态：{{licenseInfo.companyName}} 终身有效</div>
        </div>
        <div *ngSwitchCase="-1">
          <div>授权状态：未授权</div>
        </div>
        <div *ngSwitchDefault>
          <ng-container *ngIf="licenseInfo.expired; else elseTemplate">
            <div>授权状态：{{licenseInfo.companyName}} 
              <span style="color: red"> 已过期: {{licenseInfo.expiredAt*1000 | date:'yyyy-MM-dd'}}</span>
            </div>
          </ng-container>
          <ng-template #elseTemplate>
            <div>授权状态：{{licenseInfo.companyName}} 有效期至: {{licenseInfo.expiredAt*1000 | date:'yyyy-MM-dd'}}</div>
          </ng-template>
        </div>
      </ng-container>
    </div>
    <div class="detail" style="margin: 0;" *ngIf="user$ | async as user">
        <div class="form-group" *ngIf="formGroup.get('file') as fileControl">
          <!-- <div class="col-11 d-flex align-items-center"> -->
            <button
              *ngIf="user.uid===1"
              type="button"
              class="btn btn-secondary "
              [class.ng-invalid]="fileControl.invalid"
              [class.ng-touched]="!fileControl.untouched"
              (click)="upload()"
            >
              <div *ngIf="licenseInfo$ | async as licenseInfo" [ngSwitch]="licenseInfo.expiredAt">
                <div *ngSwitchCase="0">修改授权文件</div>
                <div *ngSwitchCase="-1">上传授权文件</div>
                <div *ngSwitchDefault>修改授权文件</div>
              </div>
              
            </button>
            <span class="text-muted ml-3" *ngIf="formGroup.valueChanges | async as value">
              {{ value?.file?.name }}
            </span>
          <!-- </div> -->
      </div>
    </div>
    <div class="category">系统信息</div>
    <div class="detail">
      <div><span>系统名称： </span> {{ sysName }}</div>
      <div><span>系统版本： </span> {{ sysVersion }}</div>
      <div><span>更新时间： </span>{{ upgradeDate | date }}</div>
    </div>

    <div class="category">系统状态</div>
    <div class="detail">
      <div><span>上次启动时间：</span> {{ launchDate | date }}</div>
      <div><span>运行时间：</span> {{ launchDays }}</div>
    </div>

    <div class="category">空间占用</div>
    <div class="detail">
      <div><span>图片：</span> {{ picStorage }}</div>
    </div>

    <div class="category">WEB管理员数量</div>
    <div class="detail">
      <div><span>人数：</span> {{ adminNum }}</div>
    </div>
  </div>
</ng-container>

<ng-template #uploadAlert>
  <div class="modal-body content">
    {{uploadAlertText}}
  </div>
  <div class="modal-footer">
    <button class="btn btn-primary" (click)="onOk()">确定</button>
  </div>
</ng-template>